DXL Script to select/unselect requirements for a project based on top level

I have organised my data in 2 formal modules.

Feature list module having following columns

ID Feature_Name Feature_Diversity_ID(Enum) ProjectA(Boolean) ProjectB(boolean) ..

The idea is to say yes or no for a feature for a specific project.

I have organised the detailed requiremtns in other module where I have same set of feature diversity used for requirements. Now based on the Project Yes/No, I want to set an attribute having multi-value of projects to which this requirement applies.

The idea is to do requirement selection at a much higher level and then generate the requirement spec by setting the appropriate attributes in the detailed requirement module. Can someone help me how to go about this.
SystemAdmin - Tue May 11 01:52:59 EDT 2010

Re: DXL Script to select/unselect requirements for a project based on top level
Mathias Mamsch - Tue May 11 13:44:51 EDT 2010

A DOORS way to go about this would be to link the Features to the Projects (using a module for each) and then link the requirements to the features. Then you can get the information about the project over the links. For this you would use a DXL attribute, which could look like this:
 

Link L 
string s = ""
 
for L in obj->"*" do {
   ModuleVersion mv = targetVersion L 
   m = data mv
   // if the target module is not open yet, open it invisibly ...
   if (null m) m = load (mv, false)
   // silently skip this link if we cannot read the target module
   if (null m) continue
   // check if we are at the right target module
   if (name m != "My Feature Module") continue
   // get the link target
   Object tgt = target L
   // silently skip the link if the link goes to a deleted object
   if (!null tgt && !isDelted tgt) {
        bool inPrjA = tgt."ProjectA"
        bool inPrjB = tgt."ProjectB"
        if (inPrjA) s = "Project A"    
        if (inPrjB) s = s (s == "" ? "" : "\n") "Project B"
   }
}
 
obj.attrDXLName = s

 


what is the "Feature_Diversity_ID" ? If you want to use this ID for finding your Features the code would get a little more complex, since you would need to search the Feature module for the right objects to read the projects.

Hope this gives you a start ... Regards, Mathias

 

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

 

Re: DXL Script to select/unselect requirements for a project based on top level
SystemAdmin - Tue May 11 22:23:31 EDT 2010

Mathias Mamsch - Tue May 11 13:44:51 EDT 2010

A DOORS way to go about this would be to link the Features to the Projects (using a module for each) and then link the requirements to the features. Then you can get the information about the project over the links. For this you would use a DXL attribute, which could look like this:
 

Link L 
string s = ""
 
for L in obj->"*" do {
   ModuleVersion mv = targetVersion L 
   m = data mv
   // if the target module is not open yet, open it invisibly ...
   if (null m) m = load (mv, false)
   // silently skip this link if we cannot read the target module
   if (null m) continue
   // check if we are at the right target module
   if (name m != "My Feature Module") continue
   // get the link target
   Object tgt = target L
   // silently skip the link if the link goes to a deleted object
   if (!null tgt && !isDelted tgt) {
        bool inPrjA = tgt."ProjectA"
        bool inPrjB = tgt."ProjectB"
        if (inPrjA) s = "Project A"    
        if (inPrjB) s = s (s == "" ? "" : "\n") "Project B"
   }
}
 
obj.attrDXLName = s

 


what is the "Feature_Diversity_ID" ? If you want to use this ID for finding your Features the code would get a little more complex, since you would need to search the Feature module for the right objects to read the projects.

Hope this gives you a start ... Regards, Mathias

 

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

 

I have created 2 formal modules: Features and Requirements

Module Features has the following

ID-Feature-FeatureDiversity-ProjectA-ProjectB-ProjectC
1-Feature1-Feature_Div1-True-False-True
2-Feature2-Feature_Div2-False-True-True
3-Feature3-Feature_Div3-False-True-True

Module Requirements has the following

ID-Requirement-FeatureDiversity-ProjectUsed(multi value Enum)
1-Requirement1-Feature_Div1- <Assigned by script to ProjectA,ProjectC>
2-Requirement2-Feature_Div1- <Assigned by script to ProjectA,ProjectC>
3-Requirement3-Feature_Div2- <Assigned by script to ProjectB,ProjectC>
4-Requirement4-Feature_Div3- <Assigned by script to ProjectB, ProjectC>

Do I need to create links first and then assign the ProjectUsed attribute using the script or all this can be done by the script.

Re: DXL Script to select/unselect requirements for a project based on top level
Mathias Mamsch - Wed May 12 11:46:03 EDT 2010

SystemAdmin - Tue May 11 22:23:31 EDT 2010
I have created 2 formal modules: Features and Requirements

Module Features has the following

ID-Feature-FeatureDiversity-ProjectA-ProjectB-ProjectC
1-Feature1-Feature_Div1-True-False-True
2-Feature2-Feature_Div2-False-True-True
3-Feature3-Feature_Div3-False-True-True

Module Requirements has the following

ID-Requirement-FeatureDiversity-ProjectUsed(multi value Enum)
1-Requirement1-Feature_Div1- <Assigned by script to ProjectA,ProjectC>
2-Requirement2-Feature_Div1- <Assigned by script to ProjectA,ProjectC>
3-Requirement3-Feature_Div2- <Assigned by script to ProjectB,ProjectC>
4-Requirement4-Feature_Div3- <Assigned by script to ProjectB, ProjectC>

Do I need to create links first and then assign the ProjectUsed attribute using the script or all this can be done by the script.

If you use no links the code gets a little easier, but also a little slower, since you need to search the feature module for the feature diversity you are looking for. Regards, Mathias
 

string s = ""
 
string sObjDiversity = obj."FeatureDiversity" 
Module m = read("Features", false) 
 
Object tgt
 
for tgt in m do {
    if (isDeleted tgt) continue
    if (tgt."FeatureDiversity" "" == sObjDiversity) {
        bool inPrjA = tgt."ProjectA"
        bool inPrjB = tgt."ProjectB"
        bool inPrjC = tgt."ProjectC"
        if (inPrjA) s = "Project A"    
        if (inPrjB) s = s (s == "" ? "" : "\n") "Project B"
        if (inPrjC) s = s (s == "" ? "" : "\n") "Project C"
        break
    }
}
 
 
obj.attrDXLName = s

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

 

Re: DXL Script to select/unselect requirements for a project based on top level
SystemAdmin - Wed May 12 23:33:30 EDT 2010

Mathias Mamsch - Wed May 12 11:46:03 EDT 2010

If you use no links the code gets a little easier, but also a little slower, since you need to search the feature module for the feature diversity you are looking for. Regards, Mathias
 

string s = ""
 
string sObjDiversity = obj."FeatureDiversity" 
Module m = read("Features", false) 
 
Object tgt
 
for tgt in m do {
    if (isDeleted tgt) continue
    if (tgt."FeatureDiversity" "" == sObjDiversity) {
        bool inPrjA = tgt."ProjectA"
        bool inPrjB = tgt."ProjectB"
        bool inPrjC = tgt."ProjectC"
        if (inPrjA) s = "Project A"    
        if (inPrjB) s = s (s == "" ? "" : "\n") "Project B"
        if (inPrjC) s = s (s == "" ? "" : "\n") "Project C"
        break
    }
}
 
 
obj.attrDXLName = s

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

 

Thanks Mathias.

What is the purpose of this statement: obj.attrDXLName = s

I want to assign the s value to ProjectUsed atribute wihich is a multi value enum type.

This is how my code looks now:

string s = ""
Module currModule = current Module
Object obj = null

for obj in currModule do
{
if (obj."Object Text" "" == "")
break
string sObjDiversity = obj."FeatureDiversity"
Module m = read("Features", false)

Object tgt

for tgt in m do {
if (isDeleted tgt) continue
if (tgt."FeatureDiversity" "" == sObjDiversity) {
bool inPrjA = tgt."ProjectA"
bool inPrjB = tgt."ProjectB"
bool inPrjC = tgt."ProjectC"
if (inPrjA) s = "Project A"
if (inPrjB) s = s (s == "" ? "" : "\n") "Project B"
if (inPrjC) s = s (s == "" ? "" : "\n") "Project C"
break
}
}
obj.attrDXLName = s
}

Re: DXL Script to select/unselect requirements for a project based on top level
Mathias Mamsch - Thu May 13 07:51:40 EDT 2010

SystemAdmin - Wed May 12 23:33:30 EDT 2010
Thanks Mathias.

What is the purpose of this statement: obj.attrDXLName = s

I want to assign the s value to ProjectUsed atribute wihich is a multi value enum type.

This is how my code looks now:

string s = ""
Module currModule = current Module
Object obj = null

for obj in currModule do
{
if (obj."Object Text" "" == "")
break
string sObjDiversity = obj."FeatureDiversity"
Module m = read("Features", false)

Object tgt

for tgt in m do {
if (isDeleted tgt) continue
if (tgt."FeatureDiversity" "" == sObjDiversity) {
bool inPrjA = tgt."ProjectA"
bool inPrjB = tgt."ProjectB"
bool inPrjC = tgt."ProjectC"
if (inPrjA) s = "Project A"
if (inPrjB) s = s (s == "" ? "" : "\n") "Project B"
if (inPrjC) s = s (s == "" ? "" : "\n") "Project C"
break
}
}
obj.attrDXLName = s
}

I supposed you want to use a DXL attribute for showing the associated project values in your Module. You can make this attribute an Enumeration or a Text attribute (does not matter, because a DXL attribute is not editable). The attrDXLName is the name of the DXL attribute that is currently calculated and is assigned by DOORS automatically. Using a DXL attribute might be a good idea, since it will update automatically if you change something. In this case you can use the code I provided.

If you just want to fill a normal attribute with the projects (e.g. to edit them afterwards) you can replace the obj.attrDXLName = s by obj."ProjectUsed" = s and as you already did put a loop for obj in current module do around the code. Regards, Mathias


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Re: DXL Script to select/unselect requirements for a project based on top level
SystemAdmin - Mon May 17 23:32:42 EDT 2010

Mathias Mamsch - Thu May 13 07:51:40 EDT 2010
I supposed you want to use a DXL attribute for showing the associated project values in your Module. You can make this attribute an Enumeration or a Text attribute (does not matter, because a DXL attribute is not editable). The attrDXLName is the name of the DXL attribute that is currently calculated and is assigned by DOORS automatically. Using a DXL attribute might be a good idea, since it will update automatically if you change something. In this case you can use the code I provided.

If you just want to fill a normal attribute with the projects (e.g. to edit them afterwards) you can replace the obj.attrDXLName = s by obj."ProjectUsed" = s and as you already did put a loop for obj in current module do around the code. Regards, Mathias


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Vilen Dank Mathais.